package com.edwin.websitebe.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edwin.websitebe.mapper.GameTypeMapMapper;
import com.edwin.websitebe.model.GameTypeMap;
import com.edwin.websitebe.service.GameTypeMapService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GameTypeMapServiceImpl extends ServiceImpl<GameTypeMapMapper, GameTypeMap>
        implements GameTypeMapService {

    @Override
    public boolean deleteByGameId(Long gameId) {
        LambdaQueryWrapper<GameTypeMap> wrapper = new QueryWrapper<GameTypeMap>().lambda()
                .eq(GameTypeMap::getGameId, gameId);
        return this.remove(wrapper);
    }

    @Override
    public boolean deleteByTypeId(Long typeId) {
        LambdaQueryWrapper<GameTypeMap> wrapper = new QueryWrapper<GameTypeMap>().lambda()
                .eq(GameTypeMap::getTypeId, typeId);
        return this.remove(wrapper);
    }

    @Override
    public List<GameTypeMap> listByGameId(Long gameId) {
        LambdaQueryWrapper<GameTypeMap> wrapper = new QueryWrapper<GameTypeMap>().lambda()
                .eq(GameTypeMap::getGameId, gameId);
        return this.list(wrapper);
    }

}
